package com.example.user3.demo.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.user3.demo.R;

public class ItemFragment extends Fragment {

    public static ItemFragment getUserInfoFragment(String userId) {
        ItemFragment ItemFragment = new ItemFragment();
        Bundle bundle = new Bundle();
        bundle.putString("userId", userId);
        ItemFragment.setArguments(bundle);
        return ItemFragment;
    }
    LinearLayout layout;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
       View view=  inflater.inflate(R.layout.layout_fragment,null);
        layout =view.findViewById(R.id.layout);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        Log.i("zzy","loadRemoteData()"+"");
        if(getArguments().getString("userId").equals("0")){
            layout.setBackgroundColor(Color.parseColor("#ff0000"));
        }else{
            layout.setBackgroundColor(Color.parseColor("#00ff00"));
        }
    }
    //    @Override
//    protected int getLayoutId() {
//        return R.layout.layout_fragment;
//    }

//    @Override
//    protected void loadRemoteData() {
//
//    }
}
